* ======================================
* ------- Distributions distance -------
* ======================================


	use "$dta\Estimationsample.dta", clear

	gen one = 1
	keep if year == 2015
	
	
* Panel A: Family
* ===============

	preserve
	keep if Fam1Same == 1
	replace Fam1Pol_dist = 50 if Fam1Pol_dist > 50
	hist Fam1Pol_dist, width(2) start(0) scheme(plotplain) ///
		ytitle(Density, size(vlarge)) ylab(,labsize(large)) ///
		xtitle("Distance (km)", size(vlarge)) ///
		xlab(0(10)40 50 "50+", labsize(large)) ///
		title("Panel A: Family" "(close)", size(vlarge)) ///
		name(fam_d, replace)
	restore
	
	
* Panel B: Co-workers
* ===================

	* Distance
	preserve
	keep if Work1 == 1
	keep if Work1Same == 1
	replace Work1Pol_dist = 50 if Work1Pol_dist > 50
	hist Work1Pol_dist, width(2) start(0) scheme(plotplain) ///
		ytitle(Density, size(vlarge)) ylab(,labsize(large)) ///
		xtitle("Distance (km)", size(vlarge)) ///
		xlab(0(10)40 50 "50+", labsize(large)) ///
		title("Panel B: Co-workers" "(age-establishment)", size(vlarge)) ///
		name(work_d, replace) 
	restore
	
	
* Panel C: Immigrants
* ===================

	* Distance
	preserve
	keep if Imm1 == 1
	keep if Imm1Same == 1
	replace Imm1Pol_dist = 50 if Imm1Pol_dist > 50
	hist Imm1Pol_dist, width(2) start(0) scheme(plotplain)  ///
		ytitle(Density, size(vlarge)) ylab(,labsize(large)) ///
		xtitle("Distance (km)", size(vlarge)) ///
		xlab(0(10)40 50 "50+", labsize(large)) ///
		title("Panel C: Immigrants" "(3-digit)", size(vlarge)) ///
		name(imm_d, replace)
	restore
	
	
* Combine panels
* ==============

	graph combine fam_d work_d imm_d, row(1) scheme(plotplain) xsize(10) ///
		ycommon
		
	graph export "$figs\DistributionsDistance.pdf", replace

